package com.sl.au.controller;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.sl.au.entity.Account;
import com.sl.au.entity.EXDEgetPayBackTypeAreaPerson;
import com.sl.au.entity.EXDEpayHistoryInfo;
import com.sl.au.service.EXDEgetPayBackTypeAreaPersionService;
import com.sl.au.service.EXDEpayHistoryService;

/**
 * 人员回款类型分析控制器
 */
@RestController

@RequestMapping(value="/ui/analyzeStaff")
public class PayAnalyzeStaffController extends BaseController{
	@Autowired
	EXDEgetPayBackTypeAreaPersionService exdegetPayBackTypeAreaService;
	@RequestMapping(method = RequestMethod.GET)
    public ModelAndView index(){
        ModelAndView modelAndView=createLayoutView("paymentSearch/analyzeStaff");
        return modelAndView;
    }
    @RequestMapping(value = "/getTwo", method = RequestMethod.POST)
	public Map<String, Object> getpage(HttpServletRequest request) {
		Map<String,Object> map = new HashMap<String,Object>();
		Map<String,String> condition = new HashMap<String,String>();
		Account a = this.getMyAccount();
		int start = Integer.parseInt(request.getParameter("start"));
		int length = Integer.parseInt(request.getParameter("length"));
		String superior = a.getUser().getSaleArea().getSuperior(); //获取部门信息
		//String superior = "成套处";
		String enddate = request.getParameter("enddate");
		String begindate = request.getParameter("begindate");
		condition.put("enddate", enddate);
		condition.put("begindate",begindate);
		condition.put("superior", superior);
        List<EXDEgetPayBackTypeAreaPerson> users = null;
		users = exdegetPayBackTypeAreaService.getPayDevice(begindate,enddate,superior);
		//long count =0;		
		//count=exdegetPayBackTypeAreaService.getCount(key);
		map.put("data", users);
		map.put("draw", request.getParameter("draw"));
		map.put("recordsFiltered", users.size());
		map.put("recordsTotal", users.size());
		return map;
	}
    
}
